home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / amiga.free / sorgenti vari / wolf3dmacsource.sit / Wolf3DMacSource / Refresh2.c < prev    next >
C/C++ Source or Header  |  1994-09-29  |  8KB  |  134 lines

  1. #include "WolfDef.h"
  2. #include <stdlib.h>
  3.  
  4. Word MathSize;            /* What size of math data is calculated? */
  5. Word *scaleatzptr;        /* Pointer to the scale table for z projection */
  6. short *xtoviewangle;    /* Screen x to view angle */
  7. short *viewangletox;    /* View angle to screen x */
  8. short *finetangent;        /* Fine tangent table */
  9. short *finesine;        /* Fine sine table */
  10.  
  11. fixed_t sintable[ANGLES] = {
  12. 0,3,6,9,13,16,19,22,25,28,31,34,37,41,44,47,
  13. 50,53,56,59,62,65,68,71,74,77,80,83,86,89,92,95,
  14. 98,100,103,106,109,112,115,117,120,123,126,128,131,134,136,139,
  15. 142,144,147,149,152,154,157,159,162,164,167,169,171,174,176,178,
  16. 180,183,185,187,189,191,193,195,197,199,201,203,205,207,208,210,
  17. 212,214,215,217,219,220,222,223,225,226,228,229,231,232,233,234,
  18. 236,237,238,239,240,241,242,243,244,245,246,247,247,248,249,249,
  19. 250,251,251,252,252,253,253,253,254,254,254,255,255,255,255,255,
  20. 255,255,255,255,255,255,254,254,254,253,253,253,252,252,251,251,
  21. 250,249,249,248,247,247,246,245,244,243,242,241,240,239,238,237,
  22. 236,234,233,232,231,229,228,226,225,223,222,220,219,217,215,214,
  23. 212,210,208,207,205,203,201,199,197,195,193,191,189,187,185,183,
  24. 180,178,176,174,171,169,167,164,162,159,157,154,152,149,147,144,
  25. 142,139,136,134,131,128,126,123,120,117,115,112,109,106,103,100,
  26. 98,95,92,89,86,83,80,77,74,71,68,65,62,59,56,53,
  27. 50,47,44,41,37,34,31,28,25,22,19,16,13,9,6,3,
  28. 0,-3,-6,-9,-13,-16,-19,-22,-25,-28,-31,-34,-37,-41,-44,-47,
  29. -50,-53,-56,-59,-62,-65,-68,-71,-74,-77,-80,-83,-86,-89,-92,-95,
  30. -98,-100,-103,-106,-109,-112,-115,-117,-120,-123,-126,-128,-131,-134,-136,-139,
  31. -142,-144,-147,-149,-152,-154,-157,-159,-162,-164,-167,-169,-171,-174,-176,-178,
  32. -180,-183,-185,-187,-189,-191,-193,-195,-197,-199,-201,-203,-205,-207,-208,-210,
  33. -212,-214,-215,-217,-219,-220,-222,-223,-225,-226,-228,-229,-231,-232,-233,-234,
  34. -236,-237,-238,-239,-240,-241,-242,-243,-244,-245,-246,-247,-247,-248,-249,-249,
  35. -250,-251,-251,-252,-252,-253,-253,-253,-254,-254,-254,-255,-255,-255,-255,-255,
  36. -255,-255,-255,-255,-255,-255,-254,-254,-254,-253,-253,-253,-252,-252,-251,-251,
  37. -250,-249,-249,-248,-247,-247,-246,-245,-244,-243,-242,-241,-240,-239,-238,-237,
  38. -236,-234,-233,-232,-231,-229,-228,-226,-225,-223,-222,-220,-219,-217,-215,-214,
  39. -212,-210,-208,-207,-205,-203,-201,-199,-197,-195,-193,-191,-189,-187,-185,-183,
  40. -180,-178,-176,-174,-171,-169,-167,-164,-162,-159,-157,-154,-152,-149,-147,-144,
  41. -142,-139,-136,-134,-131,-128,-126,-123,-120,-117,-115,-112,-109,-106,-103,-100,
  42. -98,-95,-92,-89,-86,-83,-80,-77,-74,-71,-68,-65,-62,-59,-56,-53,
  43. -50,-47,-44,-41,-37,-34,-31,-28,-25,-22,-19,-16,-13,-9,-6,-3
  44. };
  45.  
  46. fixed_t costable[ANGLES] = {
  47. 255,255,255,255,255,255,254,254,254,253,253,253,252,252,251,251,
  48. 250,249,249,248,247,247,246,245,244,243,242,241,240,239,238,237,
  49. 236,234,233,232,231,229,228,226,225,223,222,220,219,217,215,214,
  50. 212,210,208,207,205,203,201,199,197,195,193,191,189,187,185,183,
  51. 180,178,176,174,171,169,167,164,162,159,157,154,152,149,147,144,
  52. 142,139,136,134,131,128,126,123,120,117,115,112,109,106,103,100,
  53. 98,95,92,89,86,83,80,77,74,71,68,65,62,59,56,53,
  54. 50,47,44,41,37,34,31,28,25,22,19,16,13,9,6,3,
  55. 0,-3,-6,-9,-13,-16,-19,-22,-25,-28,-31,-34,-37,-41,-44,-47,
  56. -50,-53,-56,-59,-62,-65,-68,-71,-74,-77,-80,-83,-86,-89,-92,-95,
  57. -98,-100,-103,-106,-109,-112,-115,-117,-120,-123,-126,-128,-131,-134,-136,-139,
  58. -142,-144,-147,-149,-152,-154,-157,-159,-162,-164,-167,-169,-171,-174,-176,-178,
  59. -180,-183,-185,-187,-189,-191,-193,-195,-197,-199,-201,-203,-205,-207,-208,-210,
  60. -212,-214,-215,-217,-219,-220,-222,-223,-225,-226,-228,-229,-231,-232,-233,-234,
  61. -236,-237,-238,-239,-240,-241,-242,-243,-244,-245,-246,-247,-247,-248,-249,-249,
  62. -250,-251,-251,-252,-252,-253,-253,-253,-254,-254,-254,-255,-255,-255,-255,-255,
  63. -255,-255,-255,-255,-255,-255,-254,-254,-254,-253,-253,-253,-252,-252,-251,-251,
  64. -250,-249,-249,-248,-247,-247,-246,-245,-244,-243,-242,-241,-240,-239,-238,-237,
  65. -236,-234,-233,-232,-231,-229,-228,-226,-225,-223,-222,-220,-219,-217,-215,-214,
  66. -212,-210,-208,-207,-205,-203,-201,-199,-197,-195,-193,-191,-189,-187,-185,-183,
  67. -180,-178,-176,-174,-171,-169,-167,-164,-162,-159,-157,-154,-152,-149,-147,-144,
  68. -142,-139,-136,-134,-131,-128,-126,-123,-120,-117,-115,-112,-109,-106,-103,-100,
  69. -98,-95,-92,-89,-86,-83,-80,-77,-74,-71,-68,-65,-62,-59,-56,-53,
  70. -50,-47,-44,-41,-37,-34,-31,-28,-25,-22,-19,-16,-13,-9,-6,-3,
  71. 0,3,6,9,13,16,19,22,25,28,31,34,37,41,44,47,
  72. 50,53,56,59,62,65,68,71,74,77,80,83,86,89,92,95,
  73. 98,100,103,106,109,112,115,117,120,123,126,128,131,134,136,139,
  74. 142,144,147,149,152,154,157,159,162,164,167,169,171,174,176,178,
  75. 180,183,185,187,189,191,193,195,197,199,201,203,205,207,208,210,
  76. 212,214,215,217,219,220,222,223,225,226,228,229,231,232,233,234,
  77. 236,237,238,239,240,241,242,243,244,245,246,247,247,248,249,249,
  78. 250,251,251,252,252,253,253,253,254,254,254,255,255,255,255,255
  79. };
  80.  
  81. Word tantoangle[513] = {
  82. 0,20,40,61,81,101,122,142,162,183,203,224,244,264,285,305,
  83. 325,346,366,386,407,427,447,468,488,508,529,549,569,590,610,630,
  84. 651,671,691,711,732,752,772,792,813,833,853,873,894,914,934,954,
  85. 974,995,1015,1035,1055,1075,1096,1116,1136,1156,1176,1196,1216,1236,1256,1277,
  86. 1297,1317,1337,1357,1377,1397,1417,1437,1457,1477,1497,1517,1537,1556,1576,1596,
  87. 1616,1636,1656,1676,1696,1715,1735,1755,1775,1795,1814,1834,1854,1874,1893,1913,
  88. 1933,1952,1972,1992,2011,2031,2051,2070,2090,2109,2129,2148,2168,2187,2207,2226,
  89. 2246,2265,2285,2304,2323,2343,2362,2381,2401,2420,2439,2459,2478,2497,2516,2536,
  90. 2555,2574,2593,2612,2631,2650,2669,2688,2708,2727,2746,2765,2784,2802,2821,2840,
  91. 2859,2878,2897,2916,2935,2953,2972,2991,3010,3028,3047,3066,3084,3103,3122,3140,
  92. 3159,3177,3196,3214,3233,3251,3270,3288,3307,3325,3343,3362,3380,3398,3416,3435,
  93. 3453,3471,3489,3508,3526,3544,3562,3580,3598,3616,3634,3652,3670,3688,3706,3724,
  94. 3742,3759,3777,3795,3813,3831,3848,3866,3884,3901,3919,3937,3954,3972,3989,4007,
  95. 4024,4042,4059,4077,4094,4112,4129,4146,4164,4181,4198,4215,4233,4250,4267,4284,
  96. 4301,4318,4335,4352,4369,4386,4403,4420,4437,4454,4471,4488,4505,4521,4538,4555,
  97. 4572,4588,4605,4622,4638,4655,4671,4688,4704,4721,4737,4754,4770,4787,4803,4819,
  98. 4836,4852,4868,4884,4901,4917,4933,4949,4965,4981,4997,5013,5029,5045,5061,5077,
  99. 5093,5109,5125,5141,5156,5172,5188,5204,5219,5235,5251,5266,5282,5297,5313,5328,
  100. 5344,5359,5375,5390,5406,5421,5436,5452,5467,5482,5497,5513,5528,5543,5558,5573,
  101. 5588,5603,5618,5633,5648,5663,5678,5693,5708,5723,5738,5752,5767,5782,5797,5811,
  102. 5826,5841,5855,5870,5884,5899,5913,5928,5942,5957,5971,5985,6000,6014,6028,6043,
  103. 6057,6071,6085,6100,6114,6128,6142,6156,6170,6184,6198,6212,6226,6240,6254,6268,
  104. 6282,6295,6309,6323,6337,6350,6364,6378,6391,6405,6419,6432,6446,6459,6473,6486,
  105. 6500,6513,6527,6540,6553,6567,6580,6593,6606,6620,6633,6646,6659,6672,6685,6698,
  106. 6711,6724,6737,6750,6763,6776,6789,6802,6815,6828,6841,6853,6866,6879,6892,6904,
  107. 6917,6930,6942,6955,6967,6980,6992,7005,7017,7030,7042,7055,7067,7079,7092,7104,
  108. 7116,7129,7141,7153,7165,7177,7190,7202,7214,7226,7238,7250,7262,7274,7286,7298,
  109. 7310,7322,7333,7345,7357,7369,7381,7392,7404,7416,7428,7439,7451,7462,7474,7486,
  110. 7497,7509,7520,7532,7543,7555,7566,7577,7589,7600,7611,7623,7634,7645,7657,7668,
  111. 7679,7690,7701,7712,7724,7735,7746,7757,7768,7779,7790,7801,7812,7823,7833,7844,
  112. 7855,7866,7877,7888,7898,7909,7920,7931,7941,7952,7963,7973,7984,7994,8005,8015,
  113. 8026,8036,8047,8057,8068,8078,8089,8099,8109,8120,8130,8140,8151,8161,8171,8181,
  114. 8192};
  115.  
  116. /**********************************
  117.  
  118.     Get the memory for the scale tables
  119.     
  120. **********************************/
  121.  
  122. void GetTableMemory(void) 
  123. {
  124.     #ifdef __MAC__        /* Only the mac version will calculate the tables */
  125.                         /* All other versions will load precalc'd tables from disk */
  126.     scaleatzptr = (Word *)AllocSomeMem(sizeof(Word)*MAXZ);
  127.     viewangletox = (short *)AllocSomeMem(sizeof(short)*FINEANGLES/2);
  128.     xtoviewangle = (short *)AllocSomeMem(sizeof(short)*(1024+1));
  129.     finetangent = (short *)AllocSomeMem(sizeof(short)*FINEANGLES/2);
  130.     finesine = (short *) AllocSomeMem(sizeof(short)*FINEANGLES/2);
  131.     #endif
  132.     MathSize = -1;        /* No math data is loaded... */
  133. }
  134.